package org.wzq.base;

import org.json.JSONException;
import org.json.JSONObject;
import org.wzq.utils.GeneralUtils;

/**
 * project:
 * author: wzq
 * date: 2014/8/8
 * description:此应用程序信息的唯一标识
 */
public class AppInfo {
    public static String pkgName;
    public static int verCode;
    private AppInfo() {
    }

    public static void init() {
        pkgName = GeneralUtils.getPkgName();
        verCode = GeneralUtils.getVersionCode();

        JSONObject json = new JSONObject();
        try {
            json.put("pkgName", pkgName);
            json.put("verCode", verCode);
        } catch (JSONException e) {
            e.printStackTrace(); // should not happen
        }
        appInfoJson = json;
        appInfo = json.toString();
    }

    public static JSONObject getInfoJson() {
        return appInfoJson;
    }

    public static String getInfo() {
        return appInfo;
    }

    private static String appInfo = null;
    private static JSONObject appInfoJson = null;
}
